Omplus.views.Skin = Omplus.base.extend(Omplus.views.TableRow, {
    omplusType: "Skin",
    components:[
        {
            omplusName: "skinButton",
            omplusType: "Button",
            model:"skin_name",
            click : function(){
                var skin = $(this).html();
                var skins = Omplus.globals.getObject("User.privileges.list").getValue();
                for(var i in skins){
                    if (skin == skins[i].skin_name){
                        Omplus.globals.getObject("User.privileges").chooseByIndex(i);
                        break;
                    }
                }
                Omplus.globals.getObject("User").getAction("updateSkin").run();
            }
        }
    ]
});

Omplus.base.define(Omplus.views.Panel, {
    omplusName: "skinPanel",
    renderTo: "body",
    height: "100%",
    showEffect:{
        name:"slide",
        time:1000,
        options:{
            direction:"up"
        }
    },
    hideEffect:{
        name:"slide",
        time:1000,
        options:{
            direction:"up"
        }
    },
    onCloseFinish : function(){
        Omplus.globals.getObject("pagePanel").show();
        Omplus.globals.getObject("statusPanel").show();
    },
    layout:{
        omplusType:"VerticalLayout",
        width: "300px",
        height: "auto"
    },
    components:[
        {
            omplusType:"Label",
            omplusName:"skinsLabel",
            model:"Assets.list.label_skins.localValue",
            controller : "languageController"
        },
        {
            omplusType:"Table",
            omplusName:"skinsTable",
            omplusProto:"Skin",
            model:"User.privileges.list",
            controller : "userController"
        }
    ]
});